Skip to content

remove apt repos component #1208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

x1e
Copy link

@x1e x1e commented Nov 19, 2020

https://wiki.postgresql.org/wiki/Apt
https://www.postgresql.org/download/linux/debian/
https://www.postgresql.org/download/linux/ubuntu/

Create the file repository configuration:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

https://wiki.postgresql.org/wiki/Apt
https://www.postgresql.org/download/linux/debian/
https://www.postgresql.org/download/linux/ubuntu/

# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
@x1e x1e requested a review from a team as a code owner November 19, 2020 02:42
@puppet-community-rangefinder
Copy link

postgresql::repo::apt_postgresql_org is a class

that may have no external impact to Forge modules.

This module is declared in 71 of 575 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

@sheenaajay
Copy link
Contributor

Thank you @x1e for submitting the PR.
The repos parameter will specify a component of the Apt repository containing the backports to manage depends on the version specified

Version parameter
https://github.com/puppetlabs/puppetlabs-postgresql/blob/main/manifests/repo.pp#L3

Repos parameter
http://apt.postgresql.org/pub/repos/apt/pool/

Hence the apt source for postgresql is specified with version.

https://github.com/puppetlabs/puppetlabs-postgresql/blob/main/manifests/repo/apt_postgresql_org.pp#L20

repos => "main ${postgresql::repo::version}",

Please let me know if you need more information.

@sheenaajay sheenaajay self-assigned this Nov 23, 2020
@x1e
Copy link
Author

x1e commented Nov 25, 2020

in debian 10 (puppetserver: 6.12.1-1buster/puppet-agent: 6.17.0-1buster), will generate
/etc/apt/sources.list.d/apt.postgresql.org.list
deb https://apt.postgresql.org/pub/repos/apt/ buster-pgdg main 9.6

Then run apt update, will get error:

Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 26, in <module>
    col.create(db)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 94, in create
    self._fill_commands(con)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 132, in _fill_commands
    self._parse_single_contents_file(con, f, fp.stdout)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 271, in _parse_single_contents_file
    priority = component_priorities[component]
KeyError: '9.6'

If delete 9.6:
deb https://apt.postgresql.org/pub/repos/apt/ buster-pgdg main

and run apt update will run successfully.

@sheenaajay
Copy link
Contributor

Thank you @x1e for the response. Tried the following on debian 10 and it didn't throw the error. Do you want to try the latest puppet agent version and see if it works for you. Thank you
class { 'postgresql::globals': manage_package_repo => true, version => '9.6', }-> class { 'postgresql::server': }

# This file is managed by Puppet. DO NOT EDIT.
# apt.postgresql.org
deb https://apt.postgresql.org/pub/repos/apt/ buster-pgdg main 9.6

apt update also executed successfully. Thank you

@x1e
Copy link
Author

x1e commented Jan 18, 2021

Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster

node 'test' {
class { 'postgresql::globals': manage_package_repo => true, version => '9.6', }-> class { 'postgresql::server': }
}

/etc/apt/sources.list.d/apt.postgresql.org.list

# This file is managed by Puppet. DO NOT EDIT.
# apt.postgresql.org
deb https://apt.postgresql.org/pub/repos/apt/ buster-pgdg main 9.6
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Get:96 https://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Packages [217 kB]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Get:97 https://apt.postgresql.org/pub/repos/apt buster-pgdg/main amd64 Contents (deb) [435 kB]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Get:98 https://apt.postgresql.org/pub/repos/apt buster-pgdg/9.6 amd64 Packages [1840 B]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Get:99 https://apt.postgresql.org/pub/repos/apt buster-pgdg/9.6 amd64 Contents (deb) [878 B]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Traceback (most recent call last):
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns:   File "/usr/lib/cnf-update-db", line 26, in <module>
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns:     col.create(db)
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns:   File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 94, in create
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns:     self._fill_commands(con)
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns:   File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 132, in _fill_commands
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns:     self._parse_single_contents_file(con, f, fp.stdout)
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns:   File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 271, in _parse_single_contents_file
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns:     priority = component_priorities[component]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: KeyError: '9.6'
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Fetched 2582 kB in 1min 13s (35.2 kB/s)
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: Reading package lists...
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
Notice: /Stage[main]/Apt::Update/Exec[apt_update]/returns: E: Sub-process returned an error code
Error: /Stage[main]/Apt::Update/Exec[apt_update]: Failed to call refresh: '/usr/bin/apt-get update' returned 100 instead of one of [0]
Error: /Stage[main]/Apt::Update/Exec[apt_update]: '/usr/bin/apt-get update' returned 100 instead of one of [0]
Notice: /Stage[main]/Postgresql::Server::Install/Package[postgresql-server]: Dependency Exec[apt_update] has failures: true
Warning: /Stage[main]/Postgresql::Server::Install/Package[postgresql-server]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Initdb/File[/var/lib/postgresql/9.6/main]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Initdb/Exec[postgresql_initdb]: Skipping because of failed dependencies

@CLAassistant
Copy link

CLAassistant commented Feb 24, 2021

CLA assistant check
All committers have signed the CLA.

@sheenaajay
Copy link
Contributor

@x1e Sorry , Couldn't reproduce the problem locally . But searched for the following error Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'. Looks like its specific to Armbian.

https://forum.armbian.com/topic/12135-problem-executing-scripts-aptupdatepost-invoke-success/
https://www.raspberrypi.org/forums/viewtopic.php?t=245395#p1497643

@pmcmaw
Copy link
Contributor

pmcmaw commented Apr 12, 2021

Hey @x1e

Just wondering if you plan on revisiting this issue.

Many thanks
Paula

@sheenaajay
Copy link
Contributor

Apologies for the delay.
Its a valid error and similar PR is raised #1282 and the tests are passing.
Much appreciated for reporting the problem and with the fix. Will get the fix in the repo. Thank you

@david22swan
Copy link
Member

david22swan commented Aug 9, 2021

@x1e Closing this as another PR with the same changes has been merged in:
#1282

We would like to thank you however for being the first to bring this to our attention and apologize that we could not get your work merged in at the time.
I hope to see more from you in the future.

@david22swan david22swan closed this Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants